#include "Ctrl/ProjectController.hpp"
#include "Model/Project.hpp"

namespace Ctrl
{

ProjectController::ProjectController( Project* pControlledProject )
	: pControlledProject_( pControlledProject)
{
}

// ---------------------------------------------------------------------------------------------------------------------
void ProjectController::subscribeToProjectDescriptionChange( const ProjectSlot::slot_type& slot )
{
	onProjectDescriptionChange_.connect( slot);	
}


// ---------------------------------------------------------------------------------------------------------------------
void ProjectController::setControlledProject( Project* pNewCtrledProject, Storage::StorageFactory* pNewStorageFactory)
{
	pControlledProject_ = std::auto_ptr< Model::Project>( pNewCtrledProject);
	pStorageFactory_ = std::auto_ptr< Storage::StorageFactory>( pNewStorageFactory);
	onProjectChanged_( pControlledProject_.get());
}

// ---------------------------------------------------------------------------------------------------------------------

void ProjectController::subscribeToProjectChanged( const ProjectChangedSlot::slot_type& slot )
{
	onProjectChanged_.connect( slot);
}



} // namespace Ctrl
